cmake_minimum_required(VERSION 3.10)
project(sm2)

set (CMAKE_C_COMPILER "/opt/riscv/gcc/bin/riscv64-unknown-linux-gnu-gcc")
#set (CMAKE_CXX_COMPILER "/opt/riscv/gcc/bin/riscv64-unknown-linux-gnu-g++")

set(CMAKE_VERBOSE_MAKEFILE on )
set(CMAKE_BUILD_TYPE "Debug")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -o2 -Wall")
#set(CMAKE_CXX_STANDARD 14)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=rv64gcv")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,/usr/riscv64-linux-gnu/lib/")


include_directories(include)
link_directories("/opt/riscv/openssl/lib")
LINK_LIBRARIES("/opt/riscv/openssl/lib/libcrypto.so" "/opt/riscv/openssl/lib/libssl.so")
add_subdirectory(src)
add_executable(sm2 src/sm2.c src/part4.c src/util.c)
target_link_libraries(sm2 sm2lib ssl crypto)
